import request from '@/utils/request'
export default class index {
  static getPermissions(query: { page: number; limit: number; sort: string }) {
    return request({
      url: 'api/permissions',
      method: 'get',
      params: query
    })
  }
  
  static getTree() {
    return request({
      url: 'api/permissions/list',
      method: 'get'
    })
  }
  
  static getPermission(id: any) {
    return request({
      url: `api/permission/${id}`,
      method: 'get'
    })
  }
  
  static deletePermission(id: any) {
    return request({
      url: `api/permissions/${id}`,
      method: 'delete'
    })
  }
  
  static addPermission(data: any = {}) {
    return request({
      url: 'api/permissions',
      method: 'post',
      data
    })
  }
  
  static updatePermission(key: number, data: any = {}) {
    return request({
      url: `api/permissions/${key}`,
      method: 'put',
      data
    })
  }
  
  static getParents() {
    return request({
      url: 'api/permissions/parents',
      method: 'get'
    })
  }
}

